package com.arcvideo.acsconnect.ui.screen;

import android.view.View;
import android.widget.RelativeLayout;

/**
 * @author shenmengchao
 * @version 1.0.0
 * @date 2018/10/10
 * @description
 */

public class FourScreen extends Screen{

    @Override
    public void refresh() {
        RelativeLayout.LayoutParams lp1 = (RelativeLayout.LayoutParams) surfaceViewList.get(0).getLayoutParams();
        lp1.width = windowWidth / 2;
        lp1.height = windowHeight / 2;
        lp1.topMargin = 0;
        lp1.leftMargin = 0;

        RelativeLayout.LayoutParams lp2 = (RelativeLayout.LayoutParams) surfaceViewList.get(1).getLayoutParams();
        lp2.width = windowWidth / 2;
        lp2.height = windowHeight / 2;
        lp2.topMargin = 0;
        lp2.leftMargin = windowWidth / 2;

        RelativeLayout.LayoutParams lp3 = (RelativeLayout.LayoutParams) surfaceViewList.get(2).getLayoutParams();
        lp3.width = windowWidth / 2;
        lp3.height = windowHeight / 2;
        lp3.topMargin = windowHeight / 2;
        lp3.leftMargin = windowWidth / 2;

        RelativeLayout.LayoutParams lp4 = (RelativeLayout.LayoutParams) surfaceViewList.get(3).getLayoutParams();
        lp4.width = windowWidth / 2;
        lp4.height = windowHeight / 2;
        lp4.topMargin = windowHeight / 2;
        lp4.leftMargin = 0;

        surfaceViewList.get(0).setLayoutParams(lp1);
        surfaceViewList.get(1).setLayoutParams(lp2);
        surfaceViewList.get(2).setLayoutParams(lp3);
        surfaceViewList.get(3).setLayoutParams(lp4);
        for (int i = 0; i < surfaceViewList.size(); i++) {
            surfaceViewList.get(i).setVisibility(i < number ? View.VISIBLE : View.GONE);
        }

        userHeadInfoLayoutList.get(0).setLayoutParams(lp1);
        userHeadInfoLayoutList.get(1).setLayoutParams(lp2);
        userHeadInfoLayoutList.get(2).setLayoutParams(lp3);
        userHeadInfoLayoutList.get(3).setLayoutParams(lp4);
        for (int i = 0; i < userHeadInfoLayoutList.size(); i++) {
            userHeadInfoLayoutList.get(i).setVisibility(i < number ? View.VISIBLE : View.GONE);
        }

    }
}
